Repository navigation
feat(reusable-ci): add opt-in fetch-base-branch-tip input to the Go CI job - #394
Merged
Merged
Conversation
…I job go-ci checks out at depth 1 with no base ref, so a consumer test that diffs a file against the default branch cannot resolve origin/<default>. A caller cannot add steps to a reusable workflow's job, so add a boolean input (default false) that fetches the default branch's tip at depth 1 right after checkout and verifies it resolves. The branch name is passed through env, not interpolated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011To9HLujjbB26zYLfwT1HY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in boolean
workflow_callinput,fetch-base-branch-tip(defaultfalse), toreusable-ci.yml. When true, thego-cijob runs a new step right after "Checkout repository":DEFAULT_BRANCHis passed throughenv:fromgithub.event.repository.default_branch, never interpolated into the script. The step usesshell: bashso it also works on any non-Linux matrix entry.Why
A consumer test diffs a file against the default branch.
go-cichecks out at depth 1 with no base ref, soorigin/<default>does not exist and the test fails by design (it refuses to pass silently without a base). A caller cannot add steps to a reusable workflow's job, so the fetch has to live here.Default unchanged
With the input unset or false the step is skipped and nothing else in the workflow changes. Other consumers pinned to
@mainare unaffected. Only the default branch's tip is fetched, not its history.Verification
actionlint .github/workflows/reusable-ci.ymlpasses with no findings.true, so it is first exercised by a consumer PR run against the merged workflow.Includes a
changelog.dfragment and the file version bump (1.21.0 to 1.22.0).🤖 Generated with Claude Code
https://claude.ai/code/session_011To9HLujjbB26zYLfwT1HY